package com.aicheyoudao;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class NearActivity extends Activity implements OnClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.near_serch);
		initView();

	}

	private void initView() {
		TextView gasstation = (TextView) findViewById(R.id.gasstation);
		TextView decorated = (TextView) findViewById(R.id.car_decorated);
		TextView carport = (TextView) findViewById(R.id.carport);
		TextView carrepair = (TextView) findViewById(R.id.car_repair);
		TextView shop = (TextView) findViewById(R.id.shop);
		TextView conversion = (TextView) findViewById(R.id.car_conversion);
		TextView beauty = (TextView) findViewById(R.id.car_beauty);
		gasstation.setOnClickListener(this);
		decorated.setOnClickListener(this);
		carport.setOnClickListener(this);
		carrepair.setOnClickListener(this);
		shop.setOnClickListener(this);
		conversion.setOnClickListener(this);
		beauty.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		String searchKey = "";
		Intent intent = null;
		switch (v.getId()) {
		case R.id.gasstation:
			searchKey = getResources()
					.getString(R.string.search_key_gasstation);
			intent = new Intent(NearActivity.this, MainMap.class);
			intent.putExtra("searchKey", searchKey);
			break;
		case R.id.car_decorated:
			searchKey = getResources().getString(
					R.string.search_key_car_decorated);
			intent = new Intent(NearActivity.this, NearSearchResActivity.class);
			intent.putExtra("searchkey", searchKey);
			break;
		case R.id.carport:
			searchKey = getResources().getString(R.string.search_key_carport);
			intent = new Intent(NearActivity.this, MainMap.class);
			intent.putExtra("searchKey", searchKey);

			break;
		case R.id.car_repair:
			searchKey = getResources()
					.getString(R.string.search_key_car_repair);
			intent = new Intent(NearActivity.this, NearSearchResActivity.class);
			intent.putExtra("searchkey", searchKey);
			break;
		case R.id.shop:
			searchKey = getResources().getString(R.string.search_key_shop);
			intent = new Intent(NearActivity.this, NearSearchResActivity.class);
			intent.putExtra("searchkey", searchKey);
			break;
		case R.id.car_conversion:
			searchKey = getResources().getString(
					R.string.search_key_car_conversion);
			intent = new Intent(NearActivity.this, NearSearchResActivity.class);
			intent.putExtra("searchkey", searchKey);
			break;
		case R.id.car_beauty:
			searchKey = getResources()
					.getString(R.string.search_key_car_beauty);
			intent = new Intent(NearActivity.this, NearSearchResActivity.class);
			intent.putExtra("searchkey", searchKey);
			break;
		}

		startActivity(intent);
	}

}
